#ifndef __WIZ_DATATYPE_REAL16_HPP__SHANHAOBO_19800429__
#define __WIZ_DATATYPE_REAL16_HPP__SHANHAOBO_19800429__

#include "./WizDataTypeFloatComponents.hpp"

namespace Wiz
{
    namespace Real16
    {
        struct Type
        {
            union
            {
                struct
                {
                    ::Wiz::UInt16::Type	Mantissa    : 10;
                    ::Wiz::UInt16::Type	Exponent    : 5;
                    ::Wiz::UInt16::Type	Sign        : 1;
                };

                ::Wiz::UInt16::Type     Encoded;
            };

            Type()
            {
                Encoded = 0;
            }

            Type(::Wiz::Real32::In R32)
            {
                ::Wiz::FloatComponents32::Type Temp(R32);

                this->Mantissa = Temp.Mantissa;
                this->Exponent = Temp.Exponent;
                this->Sign     = Temp.Sign;
            }

            Type(::Wiz::Real64::Type R64)
            {
                ::Wiz::FloatComponents64::Type Temp(R64);

                this->Mantissa = Temp.Mantissa;
                this->Exponent = Temp.Exponent;
                this->Sign     = Temp.Sign;
            }

            Type(::Wiz::Int::In I)
            {
                ::Wiz::FloatComponents32::Type Temp(I);

                this->Mantissa =
                    Temp.Mantissa;
                this->Exponent = Temp.Exponent;
                this->Sign     = Temp.Sign;
            }

            operator ::Wiz::Real32::Type()
            {
                ::Wiz::FloatComponents32::Type Temp;

                Temp.Mantissa = this->Mantissa;
                Temp.Exponent = this->Exponent;
                Temp.Sign     = this->Sign;

                return Temp.RealEncoded;
            }

            operator ::Wiz::Real64::Type()
            {
                ::Wiz::FloatComponents64::Type Temp;

                Temp.Mantissa = this->Mantissa;
                Temp.Exponent = this->Exponent;
                Temp.Sign     = this->Sign;

                return Temp.RealEncoded;
            }
        };
        WIZ_DECLARE(::Wiz::Real16::Type);
    } /// end of namespace Real16
} /// end of namespace Wiz

#endif /*__WIZ_DATATYPE_REAL16_HPP__SHANHAOBO_19800429__*/
